<?php
include('phpWebCralwer-master/LIB_http.php');
$maxfetchsize = 2974293847293;

//$username = "akinlax";
//$password = "Flourish75";
//
//$url ="https://www.isaca.org/Pages/default.aspx";
////$url = "http://php.net/manual/en/function.curl-setopt.php";
//
//$nameField ="ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtUserName";
//$passField ="ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtPassword";


/*
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$ch = curl_init($url);
*/

//init and get page
$ch = curl_init();
$aReponse = http_get('https://www.isaca.org/Pages/default.aspx', 'https://www.isaca.org/Pages/default.aspx');
$sPage = $aReponse['FILE'];
echo $sPage;die();
//********************************
//get all tag input

//regular ex
//$sRex = <<<EOD
//    /<input (?=[^>]* name=["']([^'"]*)|)(?=[^>]* value=["']([^'"]*)|)/
//EOD;
//
////0 - input | 1 - name | 2 - value;
//preg_match_all($sRex, $sPage, $aInput);
//echo '<pre>';print_r($aInput);echo '</pre>';
//$aInputClean = array();
//if(!empty($aInput)) {
//    for($i=0; $i<count($aInput[0]); ++$i) {
//        $aInputClean[$aInput[1][$i]] = $aInput[2][$i];
//    }
//}
//
//echo '<pre>';print_r($aInputClean);echo '</pre>';

include('../hlib/simple_html_dom.php');

$html = str_get_html($sPage);
$aInputClean = array();
$a = $html->find('input');

foreach($html->find('input') as $oElement) {
    if(isset($oElement->name)) {
        $aInputClean[$oElement->name] = $oElement->value;
    }
}

//echo '<pre>';print_r($aInputClean);echo '</pre>';
//#get all tag input
//********************************


//********************************
//login

//set username and password
$aInputClean['ctl00$ctl29$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtUserName'] = 'akinlax';
$aInputClean['ctl00$ctl29$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtPassword'] = 'Flourish75';
$aInputClean['__EVENTTARGET'] = 'ctl00$ctl29$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$lnkSignIn';
                                 
$aInputClean['__EVENTARGUMENT'] = '';



//$aInputClean2 = array(
//	'__SPSCEditMenu' => true,
//	'MSOWebPartPage_PostbackSource' => '',
//	'MSOTlPn_SelectedWpId' => '',
//	'MSOTlPn_View' => 0,
//	'MSOTlPn_ShowSettings' => 0,
//	'MSOGallery_SelectedLibrary' => '',
//	'MSOGallery_FilterString' => '',
//	'MSOTlPn_Button' => 'none',
//	'__EVENTTARGET' => 'ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$lnkSignIn',
//	'__EVENTARGUMENT' => '',
//	'__REQUESTDIGEST' => '0x993B5A8AFC50CFCBD34C86D41FCF7EFA8516AC17290A38774251D61DAE8B96AF1A89FEB4F02779F6B9312756408DA5B56101368A6E384C5F108C7FB3973020B8,23 Aug 2013 03:45:58 -0000',
//	'MSOAuthoringConsole_FormContext' => '',
//	'MSOAC_EditDuringWorkflow' => '',
//	'MSOSPWebPartManager_DisplayModeName' => 'Browse',
//	'MSOWebPartPage_Shared' => '',
//	'MSOLayout_LayoutChanges' => '',
//	'MSOLayout_InDesignMode' => '',
//	'MSOSPWebPartManager_OldDisplayModeName' => 'Browse',
//	'MSOSPWebPartManager_StartWebPartEditingName' => 'false',
//	'__VIEWSTATE' => '/wEPDwUBMA9kFgJmD2QWAgIBD2QWAgIDD2QWEgIGD2QWCAUmZ182NjllOWEyY185YzA2XzQxOGZfODY5MV9mMTcyMjYyYTVkZTYPZBYCZg9kFgJmD2QWBgIDD2QWAgIBDw8WAh4LTmF2aWdhdGVVcmwFJC9lY29tbWVyY2UvUGFnZXMvQ3JlYXRlLUFjY291bnQuYXNweGRkAgkPZBYCZg8WAh4TUHJldmlvdXNDb250cm9sTW9kZQspiAFNaWNyb3NvZnQuU2hhcmVQb2ludC5XZWJDb250cm9scy5TUENvbnRyb2xNb2RlLCBNaWNyb3NvZnQuU2hhcmVQb2ludCwgVmVyc2lvbj0xMi4wLjAuMCwgQ3Vsd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jdGwwMCRjdGwyOCRnXzY2OWU5YTJjXzljMDZfNDE4Zl84NjkxX2YxNzIyNjJhNWRlNiRjdGwwMSRjaGtSZW1lbWJlck1lcLWwIbMEi9qcksPW+SYgZLc0g1E=',
//	'__EVENTVALIDATION' => '/wEWBQLfioW1BQLi76qkDALH8+EgArPmlmYCsdKzwwI5cAEFauIAlbFQqTahWlw0Lezc+g==',
//	'OSB_ContextScopeType' => 'Site',
//	'OSB_ContextScopeName' => 'ISACA',
//	'ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtUserName' => 'akinlax',
//	'ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$txtPassword' => 'Flourish75',
//	'ctl00$ctl28$g_669e9a2c_9c06_418f_8691_f172262a5de6$ctl01$chkRememberMe' => ''
//);
//
//echo count($aInputClean);
//echo count($aInputClean);
//echo '<pre>';print_r($aInputClean);echo '</pre>';

#header




$a = http_post_form('https://www.isaca.org/Pages/default.aspx', 'https://www.isaca.org/Pages/default.aspx', $aInputClean);

$b = http_get('http://www.isaca.org/myisaca/_layouts/SQTCommunityForum/MyMailingLists.aspx?Source=http://www.isaca.org/myisaca/pages/default.aspx', NULL);
print_r($b);
//#login
//********************************
